From ba9f06dfdbde4eb51f1a25a1f68a0e6c8a3c5e2e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 21 May 2023 22:00:53 -0700 Subject: pot sweep function --- src/routes/(app)/pot/[name]/sweep/+page.server.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/(app)/pot/[name]/sweep/+page.server.js (limited to 'src/routes/(app)/pot/[name]/sweep/+page.server.js') diff --git a/src/routes/(app)/pot/[name]/sweep/+page.server.js b/src/routes/(app)/pot/[name]/sweep/+page.server.js new file mode 100644 index 00000000..dc6d17c1 --- /dev/null +++ b/src/routes/(app)/pot/[name]/sweep/+page.server.js @@ -0,0 +1,13 @@ +import { get, auth, post } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies, params, parent }) { + let { user } = await parent(); + let { name } = params; + let { amount } = await get(`/pot/${name}`); + + + if (!user) throw redirect(307, `/register?redirect=/pot/${name}/sweep`); + // await post('/take', { amount, name }, auth(cookies)); + return { amount, name }; +} -- cgit v1.2.3